import sys
from collections import defaultdict
from typing import List

def LMI() -> List[int]:
    """Read multiple integers from input"""
    return list(map(int, input().split()))

def LMF() -> List[float]:
    """Read multiple floats from input"""
    return list(map(float, input().split()))

def LI(n: int) -> List[str]:
    """Read n strings from input"""
    return [input() for _ in range(n)]

def RIM(rows: int, cols: int) -> List[List[int]]:
    """Read a matrix of integers"""
    return [LMI() for _ in range(rows)]

def MII():
    """Read multiple integers from input as a map"""
    return map(int, sys.stdin.readline().split())

def II():
    """Read a single integer from input"""
    return int(sys.stdin.readline())

def FI():
    """Read a single float from input"""
    return float(sys.stdin.readline())

def solve() -> None:
    try:
        n,m = MII()
        a = defaultdict(list)
        # 建立邻接表
        for _ in range(m):
            u,v = MII()
            a[u].append(v)
            a[v].append(u)

        ans = 0
        for i in range(1,n+1):
            for j in a[i]:
                ans+=(len(a[i])-1)*(len(a[j])-1)
                
        print(ans)
        
    except (EOFError, KeyboardInterrupt):
        pass

# =============================================================================
# MAIN EXECUTION
# =============================================================================

if __name__ == "__main__":
    # For multiple test cases, uncomment:
    # t = int(input())
    # for _ in range(t):
    #     solve()
    
    # For single test case:
    solve()
# 